#ifndef _ANIMATION_H
#define _ANIMATION_H

#include "GameTime.h"
#include <string>

class Animation
{
public:
	Animation(const std::string& id, int startFrame, int startupFrame, int maxFrames, int row, int frameRate = 200, bool repeat = false, bool reverseWhenRepeat = false,  bool oscillate = false, int timesRepeat = 0);
	Animation(void);
	~Animation(void);

	void update();
	void setAnimationData(const std::string& id, int startFrame, int maxFrames, int row, int frameRate = 200, bool repeat = false, bool oscillate = false);
	void reset() { _currentFrame = _startupFrame; _done = false; _reverse = false; _pause = false; _timesRepeat = _maxTimesRepeat; }
	void activate();

	void setCurrentFrame(int frame);
	const int getCurrentFrame() { return _currentFrame; }
	const int getRow() { return _row; }
	const std::string& getID() { return _id; }
	const bool done() { return _done; }
	
	bool _reverse;
	bool _pause;

	int _frameRate;
	bool _oscillate;
	bool _done;
private:
	int _currentFrame;
	int _frameInc;
	long _oldTime;
	int _maxFrames;
	int _startFrame;
	int _startupFrame;
	std::string _id;
	int _row;
	bool _repeat;
	bool _fixedRepeat;
	int _timesRepeat;
	int _maxTimesRepeat;
	bool _reverseWhenRepeat;
};

#endif // _ANIMATION_H

